home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
edit
/
thesrc20.zip
/
words.the
< prev
next >
Wrap
Text File
|
1995-01-26
|
2KB
|
49 lines
/*
$Id: words.the 2.0 1995/01/26 16:32:27 MH Release MH $
*/
/***********************************************************************/
/* Description: REXX macro to count the number of words to a target. */
/* Syntax: words [target] */
/* Notes: This macro counts the number of words to the specified */
/* target. */
/* Full XEDIT/KEDIT/THE targets are supported. */
/***********************************************************************/
Trace o
Parse Arg args
If Words(args) = 0 Then args = 1
reply = valid_target(args)
If reply = 'ERROR' Then
Do
'EMSG Error: 17 Invalid target' args
Exit
End
If reply = 'NOTFOUND' Then
Do
'EMSG Error: 17 Target not found' args
Exit
End
start_line = Word(reply,1)
nolines = Word(reply,2)
forward = 1 /* assume direction is forward by defualt */
'EXTRACT /LINE/SIZE/STAY/' /* get various stuff */
current_line = line.1 /* save current line for later */
If nolines < 0 Then Do /* if target before current line */
forward = 0 /* indicate direction to be backward */
nolines = nolines * -1 /* make nolines positive */
End
':'||start_line
totwords = 0 /* reset changed line counter */
Do nolines /* for each line to target ... */
'EXTRACT /CURLINE/TOF/EOF' /* get current line contents, etc.*/
If tof.1 = 'ON', /* ignore line if on TOF or EOF */
| eof.1 = 'ON' Then nop
Else
totwords = totwords + Words(curline.3)
If forward = 1 Then 'N' /* if going forward, get next line */
Else 'U' /* if going backwards, get previous line */
If rc \= 0 Then Leave /* shouldn't get here */
End
'MSG' totwords 'words counted'
If stay.1 = 'ON' Then ':'||current_line
Return /* go back to THE */